package com.spzx.product.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.product.api.RemoteProductService;
import com.spzx.product.api.model.ProductSku;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 用户服务降级处理
 *
 * @author spzx
 */
@Component
@Slf4j
public class RemoteProductFallbackFactory implements FallbackFactory<RemoteProductService>{
    @Override
    public RemoteProductService create(Throwable cause) {

        log.error("获取商品SKU详情失败:{}", cause.getMessage());
        return new RemoteProductService() {
            @Override
            public R<ProductSku> gettProductsku(Long skuId,String header) {
                return null;
            }
        };
    }
}
